// eslint-disable-next-line no-unused-vars
import React from 'react';
import {getCategoryChildren} from './actions';
import CategoryTree from '../common/CategoryTree';
import {connect} from 'react-redux';
import selectorFactory from 'Shared/utils/immutableToJsSelectorFactory';

const getPages = selectorFactory(['page', 'domainData', 'categories', 'data']);
const mapStateToProps = state => ({
    pages: getPages(state),
    loading: state.getIn(['page', 'domainData', 'categories', 'isFetching'])
});

const mapDispatchToProps = dispatch => ({
    onLoadData: parent => dispatch(getCategoryChildren(parent.id))
});
export default connect(mapStateToProps, mapDispatchToProps)(CategoryTree);
